package com.hhss.qishi.controller.rabbitmq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther: zcc
 * @Date: 19-7-23 18:55
 * @Description: rabbitMQ控制器
 */
//@RestController
//@RequestMapping("rabbitmq")
public class RabbitMQController {

    @Autowired
    private Producer producer;

    /**
     * 发送消息
     * @param message
     */
    @PostMapping("message/sender")
    public void sendMessage(@RequestParam String message){
        producer.sendMsg(message);
    }

    /**
     * 查询接收消息
     */
    @GetMapping("message/receiver")
    public List<String> getReceivedMessage(){
        return Consumer.receivedMessageList;
    }

    /**
     * 清空消息
     */
    @GetMapping("message/clear")
    public void clearReceivedMessage(){
        Consumer.receivedMessageList.clear();
    }
}
